<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <link rel="stylesheet" type="text/css" href="../css/aui.2.0.css" />
    <link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css">
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../css/aui.2.0.css" />
    <script src="../script/api.js"></script>
    <style>

    </style>
</head>

<body>
    <header id='header' class="aui-bar aui-bar-nav" style="background-color: #03a9f4">
        <a class="aui-pull-left aui-btn" onclick="api.closeWin();">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title" id="middle">
            消息展示
        </div>
    </header>
    <div class="aui-content aui-margin-b-15" style="margin-top:0px;">
        <ul class="ui-selectee" id="tbodyHtml">

        </ul>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="../script/public.js"></script>
<script type="text/javascript">

    //初始化
    apiready = function () {

        searchMenu();


    }

    //获取菜单
    function searchMenu() {
        var un = localStorage.getItem('un');
        var serverUrl = localStorage.getItem('serverUrl');
        var url = serverUrl + "/app/searchMsg";
        var data = {
            values: {
                // un: un
                un: localStorage.getItem('equipUniqueId')
            }
        };
        api.ajax({
            url: url,
            method: 'post',
            dataType: 'json',
            timeout: 30,
            returnAll: false,
            data: data
        }, function (ret, err) {
            if (ret) {
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");
                if (myobj.code == "0") {
                    var str = "";
                    var list = myobj.list;
                    var html = "";
                    for (var i = 0; i < list.length; i++) {
                        html += "<li class='sortable ui-selectee ui-sortable'>";
                        html += "<ul class='aui-list aui-media-list ui-selectee'>";
                        html += "<li class='aui-list-item  ui-selectee'>";
                        html += "<div class='aui-list-item-inner ui-selectee'>";
                        html += "<div class='aui-list-item-text ui-selectee'  style='height: 30px;'>";
                        html += "<div class='aui-list-item-inner ui-selectee' style='color: black;'>" + list[i].title + "</div>";
                        html += "</div>";
                        html += "<div class='aui-list-item-text ui-selectee' style='height: 250px;'>";
                        html += "<div class='aui-list-item-inner ui-selectee' style='word-wrap: break-word;word-break: break-all;color: black;'>" + list[i].content + "</div>";
                        html += "</div>";
                        html += "</div>";
                        html += "</div>";
                        html += "</div>";
                        html += "</li>";
                        html += "</ul>";
                        html += "</li>";
                    }
                    $api.html($api.byId("tbodyHtml"), html);
                    // for (var i = 0; i < list.length; i++) {
                    //     str += "{placeholderImg: 'widget://image/ci.png',img: '',title: '"+list[i].title+"'},"
                    // }
                    // var sol = "["+ str.substr(0,str.length-1)+"]";
                    // var listContact = api.require('listContact');
                    // listContact.open({
                    //     h: api.frameHeight,
                    //     // rightBtn: [{
                    //     //     color: '#8B0000',
                    //     //     title: ''
                    //     // }],
                    //     cellBgColor:'#03a9f4',
                    //     data: {
                    //         common: [{
                    //             placeholderImg: '',
                    //             img: '',
                    //             title: '消息列表'
                    //         }],
                    //         A: eval(sol),

                    //     },
                    //     fixedOn: api.frameName
                    // }, function (ret, err) {
                    //     if (ret) {
                    //         // api.alert({
                    //         //     msg: JSON.stringify(ret)
                    //         // })
                    //     } else {
                    //         // api.alert({
                    //         //     msg: JSON.stringify(err)
                    //         // })
                    //     }
                    // });


                } else if (myobj.code == "1") {
                    api.toast({
                        msg: myobj.message,
                        duration: 3000
                    });
                }



            }
        });
    }


</script>

</html>